package beans;

import entities.NotasCreditoDetalle;
import controllers.NotasCreditoDetalleFacade;
import java.io.Serializable;
import javax.annotation.PostConstruct;
import javax.ejb.EJB;
import javax.faces.bean.ManagedBean;
import javax.faces.bean.ViewScoped;

@ManagedBean(name = "notasCreditoDetalleController")
@ViewScoped
public class NotasCreditoDetalleController extends AbstractController<NotasCreditoDetalle> implements Serializable {

    @EJB
    private NotasCreditoDetalleFacade ejbFacade;

    public NotasCreditoDetalleController() {
        super(NotasCreditoDetalle.class);
    }

    @PostConstruct
    public void init() {
        super.setFacade(ejbFacade);
    }

    @Override
    protected void setEmbeddableKeys() {
        this.getSelected().getNotasCreditoDetallePK().setNroNota(this.getSelected().getNotasCreditoCabecera().getNotasCreditoCabeceraPK().getNroNota());
        this.getSelected().getNotasCreditoDetallePK().setNroFactura(this.getSelected().getNotasCreditoCabecera().getNotasCreditoCabeceraPK().getNroFactura());
    }

    @Override
    protected void initializeEmbeddableKey() {
        this.getSelected().setNotasCreditoDetallePK(new entities.NotasCreditoDetallePK());
    }
}
